#ifndef SINGLETON_H_INCLUDED
#define SINGLETON_H_INCLUDED

#define DEFINE_SINGLETON(class) \
    template <> class* Singleton<class>::sActive = 0;

template <class T>
class Singleton
{
    public:
        static T* getActive() {
            return sActive;
        }

        static T* setActive(T* active) {
            if ((sActive) && (sActive != active))
                delete sActive;
            return sActive = active;
        }

    private:
        static T* sActive;
};

#endif // SINGLETON_H_INCLUDED
